package xq.test;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, InstantiationException {
		System.out.print("输入类的完全限定名：");
		Scanner sc = new Scanner(System.in);
		String className = sc.nextLine();
		sc.close();
//		Class<?> clazz = Thread.currentThread().getContextClassLoader()
//				.loadClass(className);
		Class<?> clazz = Class.forName(className);
		Object obj = clazz.newInstance();
		Method[] methods = clazz.getDeclaredMethods();
		for (Method m: methods) {
//			if(m.getName().contains("test"))
//				m.invoke(obj, new Object[] {});
			if(m.isAnnotationPresent(Test.class))
				m.invoke(obj, new Object[] {});
		}
	}

}
